from app.database.connections import db
import MySQLdb


class Network(db.Model):
    id = db.Column(db.BigInteger, primary_key=True)
    mac_code = db.Column(db.String)
    network_name = db.Column(db.String)
    bytes_sent = db.Column(db.Numeric)
    bytes_recv = db.Column(db.Numeric)
    packets_sent = db.Column(db.BigInteger)
    packets_recv = db.Column(db.BigInteger)
    errin = db.Column(db.BigInteger)
    errout = db.Column(db.BigInteger)
    dropin = db.Column(db.BigInteger)
    dropout = db.Column(db.BigInteger)

    # create_user_id = db.Column(db.String)
    # create_time = db.Column(db.String)
    # update_user_id = db.Column(db.String)
    # update_time = db.Column(db.String)
    # yn = db.Column(db.String)

    def __init__(self,mac_code,network_name,bytes_sent,bytes_recv,packets_sent,packets_recv,errin,errout,dropin,dropout):
        self.mac_code = mac_code
        self.network_name = network_name
        self.bytes_sent = bytes_sent
        self.bytes_recv = bytes_recv
        self.packets_sent = packets_sent
        self.packets_recv = packets_recv
        self.errin = errin
        self.errout = errout
        self.dropin = dropin
        self.dropout = dropout

    def __repr__(self):
        return '<network: %r,%r,%r,%r,%r >' % (self.id , self.mac_code , self.network_name,self.bytes_sent,self.bytes_recv)